package com.hckj.jianzhijia;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.avos.avoscloud.AVObject;
import com.hckj.jianzhijia.fragments.EnrollPeopleFragment;
import com.hckj.jianzhijia.listeners.OnBackClickListener;
import com.hckj.jianzhijia.model.NormalUser;
import com.hckj.jianzhijia.utils.ToastUtils;

import java.util.ArrayList;

import butterknife.ButterKnife;
import butterknife.InjectView;

public class EnrollActivity extends BaseActivity implements EnrollPeopleFragment.OnFragmentInteractionListener {


    @InjectView(R.id.imgv_go_back)
    ImageView imgvGoBack;
    @InjectView(R.id.rl_toolbar)
    RelativeLayout rlToolbar;
    @InjectView(R.id.fragment_enroll_people)
    FrameLayout fragmentEnrollPeople;
    private ArrayList<NormalUser> normalUserArrayList;
    private FragmentManager fragmentManager;
    private EnrollPeopleFragment enrollPeopleFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_enroll);
        ButterKnife.inject(this);
        AVObject avObject = (AVObject) getIntent().getParcelableExtra("job");
        if (avObject == null) {
            ToastUtils.showToast(getApplicationContext(), "获取工作内容失败");
            finish();
        }
        fragmentManager = getSupportFragmentManager();
        enrollPeopleFragment = EnrollPeopleFragment.newInstance(avObject);
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.fragment_enroll_people, enrollPeopleFragment);
        fragmentTransaction.commit();
        imgvGoBack.setOnClickListener(new OnBackClickListener(this));
    }


    @Override
    public void onFragmentInteraction() {
        // TODO: 2015-12-05 什么都不做，给将来的交互做一个接口
    }
}
